package com.github.catvod.spider.merge;

import android.os.Build;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.security.GeneralSecurityException;
import java.security.cert.X509Certificate;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;

public class k6 extends SSLSocketFactory {
  static String[] V0;
  
  static String[] h;
  
  public static final X509TrustManager j;
  
  private final SSLSocketFactory q;
  
  static {
    try {
      SSLSocket sSLSocket = (SSLSocket)SSLSocketFactory.getDefault().createSocket();
      if (sSLSocket != null) {
        LinkedList<String> linkedList = new LinkedList();
        this();
        for (String str : sSLSocket.getSupportedProtocols()) {
          if (!str.toUpperCase().contains("SSL"))
            linkedList.add(str); 
        } 
        h = linkedList.<String>toArray(new String[linkedList.size()]);
        if (Build.VERSION.SDK_INT < 21) {
          List<String> list1 = Arrays.asList(new String[] { 
                "TLS_RSA_WITH_AES_256_GCM_SHA384", "TLS_RSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", "TLS_ECHDE_RSA_WITH_AES_128_GCM_SHA256", "TLS_RSA_WITH_3DES_EDE_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_256_CBC_SHA", 
                "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA", "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" });
          List<String> list2 = Arrays.asList(sSLSocket.getSupportedCipherSuites());
          HashSet hashSet1 = new HashSet();
          this((Collection)list1);
          hashSet1.retainAll(list2);
          HashSet hashSet2 = new HashSet();
          this(Arrays.asList((E[])sSLSocket.getEnabledCipherSuites()));
          hashSet1.addAll(hashSet2);
          V0 = (String[])hashSet1.toArray((Object[])new String[hashSet1.size()]);
        } 
      } 
      j = new Tw();
      return;
    } catch (IOException iOException) {
      RuntimeException runtimeException = new RuntimeException(iOException);
      throw runtimeException;
    } 
  }
  
  public k6(X509TrustManager paramX509TrustManager) {
    try {
      SSLContext sSLContext = SSLContext.getInstance("TLS");
      if (paramX509TrustManager != null) {
        X509TrustManager[] arrayOfX509TrustManager2 = new X509TrustManager[1];
        arrayOfX509TrustManager2[0] = paramX509TrustManager;
        X509TrustManager[] arrayOfX509TrustManager1 = arrayOfX509TrustManager2;
      } else {
        paramX509TrustManager = null;
      } 
      sSLContext.init(null, (TrustManager[])paramX509TrustManager, null);
      this.q = sSLContext.getSocketFactory();
      return;
    } catch (GeneralSecurityException generalSecurityException) {
      throw new AssertionError();
    } 
  }
  
  private void h(SSLSocket paramSSLSocket) {
    String[] arrayOfString = h;
    if (arrayOfString != null)
      paramSSLSocket.setEnabledProtocols(arrayOfString); 
    if (Build.VERSION.SDK_INT < 21) {
      arrayOfString = V0;
      if (arrayOfString != null)
        paramSSLSocket.setEnabledCipherSuites(arrayOfString); 
    } 
  }
  
  public Socket createSocket(String paramString, int paramInt) {
    Socket socket = this.q.createSocket(paramString, paramInt);
    if (socket instanceof SSLSocket)
      h((SSLSocket)socket); 
    return socket;
  }
  
  public Socket createSocket(String paramString, int paramInt1, InetAddress paramInetAddress, int paramInt2) {
    Socket socket = this.q.createSocket(paramString, paramInt1, paramInetAddress, paramInt2);
    if (socket instanceof SSLSocket)
      h((SSLSocket)socket); 
    return socket;
  }
  
  public Socket createSocket(InetAddress paramInetAddress, int paramInt) {
    Socket socket = this.q.createSocket(paramInetAddress, paramInt);
    if (socket instanceof SSLSocket)
      h((SSLSocket)socket); 
    return socket;
  }
  
  public Socket createSocket(InetAddress paramInetAddress1, int paramInt1, InetAddress paramInetAddress2, int paramInt2) {
    Socket socket = this.q.createSocket(paramInetAddress1, paramInt1, paramInetAddress2, paramInt2);
    if (socket instanceof SSLSocket)
      h((SSLSocket)socket); 
    return socket;
  }
  
  public Socket createSocket(Socket paramSocket, String paramString, int paramInt, boolean paramBoolean) {
    paramSocket = this.q.createSocket(paramSocket, paramString, paramInt, paramBoolean);
    if (paramSocket instanceof SSLSocket)
      h((SSLSocket)paramSocket); 
    return paramSocket;
  }
  
  public String[] getDefaultCipherSuites() {
    return V0;
  }
  
  public String[] getSupportedCipherSuites() {
    return V0;
  }
  
  static final class Tw implements X509TrustManager {
    public void checkClientTrusted(X509Certificate[] param1ArrayOfX509Certificate, String param1String) {}
    
    public void checkServerTrusted(X509Certificate[] param1ArrayOfX509Certificate, String param1String) {}
    
    public X509Certificate[] getAcceptedIssuers() {
      return new X509Certificate[0];
    }
  }
}


/* Location:              /Users/hetaiyi/Desktop/my/tech/java/study/aa/temp/temp.jar!/com/github/catvod/spider/merge/k6.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       1.1.3
 */